﻿@{
  Layout = "~/Views/Shared/_Layout.cshtml";
}


<h1>Sample Calculator Using F# and SignalR</h1>
<table>
  <tbody>
    <tr>
      <td>num1:</td>
      <td>num2:</td>
    </tr>
    <tr>
      <td><input type="text" id="num1" /></td>
      <td><input type="text" id="num2" /></td>
      <td><input type="button" id="broadcast" value="Add" /></td>
    </tr>
  </tbody>
</table>
<ul id="messages"></ul>


<script type="text/javascript">
  $(function () {
    var connection = $.connection('/calcAdd');

    connection.received(function (data) {
      $('#messages').append('<li>' + data + '</li>');
    });

    connection.start();
    $("#broadcast").click(function () {
      connection.send(JSON.stringify({ num1: $('#num1').val(), num2: $('#num2').val() }));
    });
  });
</script>
